package org.hgvc.webapp.ets.jsf.beans.partner;

import org.hgvc.webapp.ets.bo.Partner;
import org.hgvc.webapp.ets.spring.service.PartnerService;
import org.jocsb.base.AbstractBean;
import org.jocsb.base.exception.BaseException;
import org.jocsb.base.util.FacesUtils;



public class PartnerBean extends AbstractBean {

	public static final String BEAN_NAME="partnerBean";
	public static final String NAV_PARTNER_PORTAL="partnerPortal";
	private Partner partner;
	private PartnerService service;

	public void setService(PartnerService service) {
		this.service = service;
	}
	public Partner getPartner() {
		return partner;
	}
	public void setPartner(Partner partner) {
		this.partner = partner;
	}
	public void setInit(String test){}
	/******************************************************/

	public String getInit(){
		try{
			if(partner==null)
				partner = service.getPartnerByUserId(this.getThisUser().getUserId());
		}catch(BaseException be){
			be.printStackTrace();
			initErrorBean(be);
		}
		return null;
	}

	public String navViewProfile(){
		PartnerProfileBean bean = (PartnerProfileBean)FacesUtils.getManagedBean(PartnerProfileBean.BEAN_NAME);
		return bean.navVewAction(partner);
	}
	

}
